-
Notifications
You must be signed in to change notification settings - Fork 7
[FL-729] [POC] Dimensioned output #992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -134,6 +134,52 @@ | |||
Transformation, | |||
) | |||
from flow360.component.simulation.simulation_params import SimulationParams | |||
|
|||
# from flow360.component.simulation.solver_builtins import ( | |||
# CD, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These won't work now.
@benflexcompute I like the idea of retiring the user-facing names, but I feel we miscommunicated overall. I see a couple big issues with this approach:
Can we have a call to discuss it a bit more? |
"""Convert output field to string""" | ||
if isinstance(output_field, str): | ||
return output_field | ||
elif isinstance(output_field, SolverVariable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand this. The output field will usually not be a raw SolverVariable, but rather an expression.
If the user writes:
fl.timeStepSize * 2
the resulting object type is an Expression
. If he assigns a raw variable to a ValueOrExpression[T]
field it will also get converted to an expression in the validator.
I understand the str
output field type is the legacy form of defining the expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes str is legacy support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure we can use expression but how do we tell expression what is the target unit? How about we do:
class SolverVariable(Variable):
...
unit_system_name: str = pd.Field("SI")
# def in_SI(self) -> SolverVariable:
def in_SI(self) -> Expression:
# return SolverVariable(unit_system_name = "SI", **(self.model_dump()))
return Expression(self*conversion_constant)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the conversion rate depends on the entire SimulationParam.... Maybe we can defer the value substitution of conversion_constant
?
@@ -61,7 +61,7 @@ def is_instance_of_type_in_union(obj, typ) -> bool: | |||
|
|||
class UnknownFloat(float): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh - this can probably be removed. It was being used by solver variables before but has been deprecated since then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
cffe740
to
4d1d239
Compare
b7fbe78
to
93518e7
Compare
3cc730d
to
bb44ad2
Compare
Superseded by #1012 |
For e.g.
and then allow per-instance overload?
👀 Following script demonstrate usage.
❓ TODO: